# Filename: jit-mda-create-backup.sh
# Usage: jit-mda-create-backup.sh <image name> <backup ip> <backup port> <size> <interval>
# Example jit-mda-create-backup.sh vm01 10.0.0.2 8002 4G 200
#
# Prepares a backup host with LVM and DRBD to receive a migration or
# Remus replication from a primary host.

imagename=$1
primaryIP=$2
backupIP=$3
backupPort=$4
size=$5
interval=$6
SCRIPTS_FOLDER=/root/scripts

echo `date +%H:%M:%S` Starting Script $0 $*
if [ -z "$imagename" -o -z "$primaryIP" -o -z "$backupIP" -o -z "$backupPort" -o -z "$size" -o -z "$interval" ]; then
	echo Incorrect parameters
	echo "Usage: $0 <image name> <primaryIP> <backupIP> <backupPort> <size> <interval>"
else
	$SCRIPTS_FOLDER/jit-mda-extract-snapshot.sh $imagename $size
	$SCRIPTS_FOLDER/jit-mda-configure-drbd.sh $imagename $primaryIP $backupIP
fi
echo `date +%H:%M:%S` Finishing Script $0
exit 0

